| Conditions | 2 |
| Paths | 2 |
| Total Lines | 52 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | // Karma configuration |
||
| 21 | module.exports = function(config) {
|
||
| 22 | config.set({
|
||
| 23 | basePath: "", |
||
| 24 | frameworks: ["jasmine"], |
||
| 25 | files: [ |
||
| 26 | { pattern: "src/**/*karma.js", watched: false },
|
||
| 27 | { pattern: "src/**/*spec.js", watched: false }
|
||
| 28 | ], |
||
| 29 | preprocessors: {
|
||
| 30 | "src/**/!(*.spec|*.karma).js": ["coverage"], |
||
| 31 | "**/*karma.js": ["webpack", "sourcemap"], |
||
| 32 | "**/*spec.js": ["webpack", "sourcemap"] |
||
| 33 | }, |
||
| 34 | customLaunchers: {
|
||
| 35 | ChromeCI: {
|
||
| 36 | base: "Chrome", |
||
| 37 | // docker needs no sandbox because perms |
||
| 38 | flags: isDocker ? ["--no-sandbox"] : [] |
||
| 39 | } |
||
| 40 | }, |
||
| 41 | webpack: webpackConf[0], |
||
| 42 | reporters: ["spec", "coverage-istanbul"], |
||
| 43 | specReporter: {
|
||
| 44 | suppressSkipped: true, |
||
| 45 | suppressPassed: true, |
||
| 46 | showSpecTiming: true |
||
| 47 | }, |
||
| 48 | coverageIstanbulReporter: {
|
||
| 49 | reports: ["html", "text", "lcov"], |
||
| 50 | dir: path.join(__dirname, "coverage"), |
||
| 51 | // if using webpack and pre-loaders, work around webpack breaking the source path |
||
| 52 | fixWebpackSourcePaths: true, |
||
| 53 | // stop istanbul outputting messages like `File [${filename}] ignored, nothing could be mapped`
|
||
| 54 | skipFilesWithNoCoverage: true, |
||
| 55 | // Most reporters accept additional config options. You can pass these through the `report-config` option |
||
| 56 | "report-config": {
|
||
| 57 | // all options available at: https://github.com/istanbuljs/istanbul-reports/blob/590e6b0089f67b723a1fdf57bc7ccc080ff189d7/lib/html/index.js#L135-L137 |
||
| 58 | html: {
|
||
| 59 | // outputs the report in ./coverage/html |
||
| 60 | subdir: "html" |
||
| 61 | } |
||
| 62 | } |
||
| 63 | }, |
||
| 64 | coverageReporter: {
|
||
| 65 | reporters: [{ type: "text" }]
|
||
| 66 | }, |
||
| 67 | webpackMiddleware: {
|
||
| 68 | // webpack-dev-middleware configuration |
||
| 69 | stats: "errors-only" |
||
| 70 | } |
||
| 71 | }); |
||
| 72 | }; |
||
| 73 |